package HeadTopBlock;

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public class main extends JavaPlugin {
    protected String PluginHead = "&a&l[HeadTopBlock]";
    temp t = new temp();


    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(new PlayerMove(),this);
        getLogger().info(ChatColor.translateAlternateColorCodes('&',PluginHead+"HeadTopBlock now is load!"));
        //super.onEnable();
    }

    @Override
    public void onDisable() {
        //super.onDisable();
        getLogger().info(ChatColor.translateAlternateColorCodes('&',PluginHead+"HeadTopBlock now is unload!"));
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        if (command.getName().equalsIgnoreCase("htb"))
        {
            if(!(sender instanceof Player))
            {
                getLogger().info(PluginHead+"命令发出者必须是玩家!");
            }

            if(!t.getflag())
            {
                t.setflag(true);
                sender.sendMessage("on");
            }else{
                t.setflag(false);
                sender.sendMessage("off");
            }
        }
        return true;
    }

}
